Day 2: Branching, Merging and collaboration workflows
September 18, 2023
Did everyone accept the invitation to the cook book of their partner?
Basic Git workflow:
Basic Git workflow:
Git is a distributed version control system
Clone your partners cookBook repo Complete task 1 “Clone” (5 min)
Local changes, publish to remote: git push
Remote changes, pull to local: git pull
This works well if
This workflow starts to be problematic when
The steps to create and work on a separate branch are easy:
To bring changes to the main branch you need to merge them.
Normally: Git merge brings the commits from the branch to main
To bring changes to the main branch you need to merge them.
If there was a commit on a common file in main, a merge commit is introduced.
To bring changes to the main branch you need to merge them.
Merge conflicts need to be solved manually. You need to chose which of the conflicting versions you want to keep.
Create a branch in your partner’s cook book Complete task 2 “Branch and merge” (10 min)
You partner now has pushed some changes to your cook book.
Get the changes from the remote. In Github Desktop
A pull request is basically asking your collaborators:
What do you think of my changes? Can we integrate them in main or do we still need to change something?
Github has nice features for pull requests:
A pull request is basically asking your collaborators:
What do you think of my changes? Can we integrate them in main or do we still need to change something?
A pull request is merged on Github when everyone agreed on the code.
Create a pull request on your partners repo Review the pull request by your partner on your own repo Complete task “Pull requests” (20 min)
Questions?
Idea: Questions and problems often arise when working with the tool.
Until then
Work with Git (~ 2 h), e.g.
Write down your problems/questions/other Git things you are interested in.
Next week we will - Discuss your questions - Look at other interesting Git things todo - e.g. Use Git from R, VS Code - Use Github to publish websites - …
Branching, Merging and Collaboration with Git